package br.rafael.mulock.controle_de_estoque.modelo.form;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ClienteForm {

	private String nome;
	
	private String endereco;
	
	private String cpf;
	
	private String observacao;
	
	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getEndereco() {
		return endereco;
	}

	public void setEndereco(String endereco) {
		this.endereco = endereco;
	}

	public String getCpf() {
		return cpf;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}

	public String getObservacao() {
		return observacao;
	}

	public void setObservacao(String observacao) {
		this.observacao = observacao;
	}

	public void reset() throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
		@SuppressWarnings("rawtypes")
		Class classe = this.getClass();

		for (Field variavel : classe.getDeclaredFields()) {
			String nome = variavel.getName();
			@SuppressWarnings("unchecked")
			Method metodo = classe.getMethod("set"+String.valueOf(nome.charAt(0)).toUpperCase()+nome.substring(1), variavel.getType());
			metodo.invoke(this, new Object[] {null});
		}
	}
}
